/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.splot;

/**
 *
 * @author Daniel Aleksandrow
 */
public class Dimensions {
    
    private static int DEFAULT_WIDTH = 400;
    private static int DEFAULT_HEIGHT = 300;
    private static int DEFAULT_PADDING_LEFT = 50;
    private static int DEFAULT_PADDING_RIGHT = 50;
    private static int DEFAULT_PADDING_TOP = 50;
    private static int DEFAULT_PADDING_BOTTOM = 50;
    
    private int width;
    private int height;
    private int padding_left;
    private int padding_right;
    private int padding_top;
    private int padding_bottom;
    
    public static enum Dimension{ WIDTH, HEIGHT, PADDINGLEFT, PADDINGRIGHT, PADDINGTOP, PADDINGBOTTOM };
    
    public Dimensions() {
        this.width = Dimensions.DEFAULT_WIDTH;
        this.height = Dimensions.DEFAULT_HEIGHT;
        this.padding_left = Dimensions.DEFAULT_PADDING_LEFT;
        this.padding_right = Dimensions.DEFAULT_PADDING_RIGHT;
        this.padding_top = Dimensions.DEFAULT_PADDING_TOP;
        this.padding_bottom = Dimensions.DEFAULT_PADDING_BOTTOM;
        
    }
    
    public Dimensions(int width, int height, int padding) {
        //FIXME: Check for valid ranges.
        this.width = width;
        this.height = height;
        this.padding_left = padding;
        this.padding_right = padding;
        this.padding_top = padding;
        this.padding_bottom = padding;
    }
    
    public int getDimension(Dimensions.Dimension d) {
            switch (d) {
                case WIDTH:
                    return this.width;
                case HEIGHT:
                    return this.height;
                case PADDINGTOP:
                    return this.padding_top;
                case PADDINGBOTTOM:
                    return this.padding_bottom;
                case PADDINGLEFT:
                    return this.padding_left;
                case PADDINGRIGHT:
                    return this.padding_right;
                default://FIXME: throw an error
                    return 0;
            }
    }

}
